<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <p>欢迎光临--水果店</p>
        <p>苹果{{fruitPrice}}￥/斤 ，折扣 < {{cheap}}折>
        </p>
        <p> 请输入你要买的斤数 <input type="text" v-model="count"></p>
        <button @click="add">结账买单~</button>
        <p>结账单：总价 <span>{{totalPrice}}</span>￥元，折后价<i>{{cheapPrice}}</i> ￥元，省了：<span>{{totalPrice -
                cheapPrice}}</span>￥元</p>
    </div>

    <script src="./vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                count: '',
                fruitPrice: 20,
                cheap: 5 ,
                totalPrice: '',
                cheapPrice: ''
            },
            methods: {
                add() {
                    this.totalPrice = this.fruitPrice * this.count
                    this.cheapPrice =  this.fruitPrice * this.count * this.cheap / 10
                }
            },





        })



    </script>


</body>

</html>